diff options
| author | Matt Kosarek <matt.kosarek@canonical.com> | 2026-03-11 17:49:05 -0400 |
|---|---|---|
| committer | Matt Kosarek <matt.kosarek@canonical.com> | 2026-03-11 17:49:05 -0400 |
| commit | 77b0f69d0c6e555349dd491d7ca209924d119e61 (patch) | |
| tree | 095cf20002f5df752c04c20af4366588bd7ba32b /src/pages/posts/[slug].astro | |
| parent | c929a29c728c6799a3f83f5ad5c1c6f99ed516d4 (diff) | |
Diffstat (limited to 'src/pages/posts/[slug].astro')
| -rw-r--r-- | src/pages/posts/[slug].astro | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/pages/posts/[slug].astro b/src/pages/posts/[slug].astro new file mode 100644 index 0000000..0f29ec5 --- /dev/null +++ b/src/pages/posts/[slug].astro @@ -0,0 +1,19 @@ +--- +import { getCollection, type CollectionEntry } from 'astro:content'; +import PostLayout from '../../layouts/PostLayout.astro'; + +export async function getStaticPaths() { + const posts = await getCollection('posts'); + return posts.map((post: CollectionEntry<'posts'>) => ({ + params: { slug: post.slug }, + props: { post }, + })); +} + +const { post } = Astro.props as { post: CollectionEntry<'posts'> }; +const { Content } = await post.render(); +--- + +<PostLayout title={post.data.title}> + <Content /> +</PostLayout> |
